<template>
  <div class="showparty_container">
    <div>
    <h2>所有派对</h2>
    <div>
      <el-button  v-for="item in partys" :key="item.id" class="party_items" @click.native="todetails(item.id)">{{item.name}}</el-button>
    </div>
    </div>
    <div>
      <p>新增一个派对</p>
      <el-button type="primary"  @click="addparty">马上新增</el-button>
    </div>
  </div>
</template>
<script>
import request from '@/utils/request'
export default {
  data () {
    return {
      partys: [],
      dialogVisible: false
    }
  },
  created () {
    this.getpartys()
  },
  methods: {
    async getpartys () {
      const res = await request({
        url: '/get_parties',
        mathod: 'GET'
      })
      this.partys = res.data
      console.log(res.data)
    },
    todetails (id) {
      console.log(id)
    },
    addparty () {
      this.$router.push('/addparty')
    }
  }
}
</script>
<style scoped lang="less">

.party_items{
  display: block;
  margin: 5px;
}
</style>
